/*
 * @Author: 肖思汗 
 * @Date: 2025-06-06 09:10:08 
 * @Last Modified by: 肖思汗
 * @Last Modified time: 2025-07-02 09:33:27
 */
import { GoodsData } from 'types/type';
import Api from './Api';
import { cloneDeep } from 'lodash';

// 商品相关的接口
class GoodsApi extends Api {

    //获取商品组
    async getProductById(productId: number | string = "-1"): Promise<GoodsData> {
        const res = await this._get('/category/page/getProductById', { productId });
        const goodsData: GoodsData = cloneDeep(res.data);
        //@ts-ignore
        goodsData.productData = JSON.parse(goodsData.productData);
        return goodsData;
    }
    //记录热点数据
    countHotProduct(productId: number) {
        return this._get("/product/countHotProduct", { productId });
    }

}


const goodsApi = new GoodsApi();

export default goodsApi;

